package features;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;

import javax.media.j3d.Shape3D;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;

import operationSolids.CSGSolid;

import bool.Solid;

import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.NormalGenerator;

/**
 * @author 
 *
 */

abstract public class Feature
{
	
	public final static int FLATHOLEBOTTOM = 0;
	public final static int CONICALHOLEBOTTOM = 1;
	public final static int FLATWITHRADIUSHOLEBOTTOM = 2;
	public final static int SPHERICALHOLEBOTTOM = 3;
	public final static int THROUGHHOLE = 4;
	public final static int STEP = 5;
	public final static int LINEARPROFILE = 6;
	public final static int BEZIERPATH = 7;
	public final static int ROUNDEDUPROFILE = 8;
	public final static int PARTIALCIRCULARPROFILE = 9;
	public final static int VEEPROFILE = 10;
	public final static int SQUAREUPROFILE = 11;
	public final static int PLANARFLOORPOCKET = 12;	
	public final static int ROUNDFLOORPOCKET = 13;	
	public final static int PLANARFACE = 14;
	
	public CSGSolid feature;
	public Placement placement;
	public Feature motherFeature = null;
	String name =null;
	public Feature(int type, Feature Mother,String name){
		super();
		this.setType(type);
		this.name=name;
		
	}
	
	private int type = 20;
	
	public Feature getMotherFeature() {
		return motherFeature;
	}
	public String getName() {
		return name;
	}
	// incluir outros tipos de erro



	private void setType(int type) {
		this.type = type;
		
	}
	public int getType(){
		return type;
	}
	
	public Color3f[] createColor(){
		Color3f[] temp = new Color3f[8];
		
		temp[0]= new Color3f(0.3f,0.3f,0.3f);
		temp[1]= new Color3f(0.3f,0.3f,0.3f);
		temp[2]= new Color3f(0.3f,0.3f,0.3f);
		temp[3]= new Color3f(0.3f,0.3f,0.3f);
		temp[4]= new Color3f(0.3f,0.3f,0.3f);
		temp[5]= new Color3f(0.3f,0.3f,0.3f);
		temp[6]= new Color3f(0.3f,0.3f,0.3f);
		temp[7]= new Color3f(0.3f,0.3f,0.3f);
		
		return temp;
	}
	
	 abstract void translate();
	 abstract void compound();
	 public abstract void drawNode(DefaultMutableTreeNode node);
	
	public void create(double x,double y, double z, int face){
		placement=new Placement(x,y,z,face);
		translate();
		compound();
	}
	
	public void create(){
		compound();
	}
	public String toString(){
		return name;
	}
	
	
	
}
